#include "pch.h"

RobotManager::RobotManager()
{
	
}

RobotManager::~RobotManager()
{
	m_RobotMap.clear();
}


// update
void RobotManager::OnUpdate(float frameTime)
{
	auto itor = m_RobotMap.begin();
	for (;itor != m_RobotMap.end(); itor++)
	{
		itor->second->OnUpdate(frameTime);
	}
}

void RobotManager::OnPreRender()
{
	auto itor = m_RobotMap.begin();
	for (;itor != m_RobotMap.end(); itor++)
	{
		itor->second->OnPreRender();
	}
}

std::shared_ptr<Robot> RobotManager::CreateRobot()
{
	std::shared_ptr<Robot> s(new Robot);
	m_RobotMap.insert(std::make_pair(s->uid, s));

	return s;
}

std::shared_ptr<Robot> RobotManager::GetRobot(uint _uid)
{
	auto itor = m_RobotMap.find(_uid);
	if(itor != m_RobotMap.end())
		return itor->second;

	return nullptr;
}